<html>
<head><meta charset="utf-8"><title>panic in tcx.parent(def_id): bug in my code or rustc_middle? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html">panic in tcx.parent(def_id): bug in my code or rustc_middle?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="200025888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200025888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200025888">(Jun 07 2020 at 14:13)</a>:</h4>
<p>While working on <a href="https://github.com/rust-lang/rust/issues/65983">https://github.com/rust-lang/rust/issues/65983</a>, I changed rustdoc around to pass DefIds to <code>resolve_str_path_error</code> instead of <code>LocalDefId</code>s. Now rustdoc is panicking on any file, including empty files. Is this a bug in my code or in <code>rustc_middle</code>? The panic comes from <code>tcx.parent(def_id)</code>:</p>
<div class="codehilite"><pre><span></span><code><span class="w">        </span><span class="k">use</span><span class="w"> </span><span class="n">rustc_middle</span>::<span class="n">ty</span>::<span class="n">DefIdTree</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">parent_node</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">tcx</span><span class="p">.</span><span class="n">parent</span><span class="p">(</span><span class="n">item</span><span class="p">.</span><span class="n">def_id</span><span class="p">);</span><span class="w"></span>
</code></pre></div>


<p>Backtrace (the relevant bits):</p>
<div class="codehilite"><pre><span></span><code>  13: core::panicking::panic_bounds_check
             at src/libcore/panicking.rs:73
  14: &lt;usize as core::slice::SliceIndex&lt;[T]&gt;&gt;::index
             at /home/joshua/src/rust/src/libcore/slice/mod.rs:2872
  15: core::slice::&lt;impl core::ops::index::Index&lt;I&gt; for [T]&gt;::index
             at /home/joshua/src/rust/src/libcore/slice/mod.rs:2732
  16: &lt;alloc::vec::Vec&lt;T&gt; as core::ops::index::Index&lt;I&gt;&gt;::index
             at /home/joshua/src/rust/src/liballoc/vec.rs:1947
  17: &lt;rustc_index::vec::IndexVec&lt;I,T&gt; as core::ops::index::Index&lt;I&gt;&gt;::index
             at /home/joshua/src/rust/src/librustc_index/vec.rs:716
  18: rustc_hir::definitions::DefPathTable::def_key
             at /home/joshua/src/rust/src/librustc_hir/definitions.rs:53
  19: rustc_metadata::rmeta::decoder::&lt;impl rustc_metadata::creader::CrateMetadataRef&gt;::def_key
             at src/librustc_metadata/rmeta/decoder.rs:1411
  20: rustc_metadata::rmeta::decoder::cstore_impl::&lt;impl rustc_middle::middle::cstore::CrateStore for rustc_metadata::creader::CStore&gt;::def_key
             at src/librustc_metadata/rmeta/decoder/cstore_impl.rs:484
  21: rustc_middle::ty::context::TyCtxt::def_key
             at src/librustc_middle/ty/context.rs:1188
  22: &lt;rustc_middle::ty::context::TyCtxt as rustc_middle::ty::DefIdTree&gt;::parent
             at src/librustc_middle/ty/mod.rs:358
  23: &lt;rustdoc::passes::collect_intra_doc_links::LinkCollector as rustdoc::fold::DocFolder&gt;::fold_item
             at src/librustdoc/passes/collect_intra_doc_links.rs:482
</code></pre></div>



<a name="200025951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200025951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200025951">(Jun 07 2020 at 14:14)</a>:</h4>
<p>oh and the message was <code>thread 'rustc' panicked at 'index out of bounds: the len is 38899 but the index is 38905', /home/joshua/src/rust/src/librustc_hir/definitions.rs:53:9</code></p>



<a name="200026038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200026038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200026038">(Jun 07 2020 at 14:17)</a>:</h4>
<p>it might be because rustdoc allocates non-real defids?</p>



<a name="200026108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200026108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200026108">(Jun 07 2020 at 14:19)</a>:</h4>
<p>What do you mean?</p>



<a name="200026121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200026121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200026121">(Jun 07 2020 at 14:20)</a>:</h4>
<p>IIRC last I looked, rustdoc sometimes has a DefId which is not "real" in the sense that it's not present in the tcx maps or so</p>



<a name="200026173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200026173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200026173">(Jun 07 2020 at 14:20)</a>:</h4>
<p>see e.g. <a href="https://github.com/Mark-Simulacrum/rust/blob/6f015768c28a6e4cf163967cb62b70c645791858/src/librustdoc/clean/types.rs#L88-L90">https://github.com/Mark-Simulacrum/rust/blob/6f015768c28a6e4cf163967cb62b70c645791858/src/librustdoc/clean/types.rs#L88-L90</a> which has special handling</p>



<a name="200026490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200026490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200026490">(Jun 07 2020 at 14:31)</a>:</h4>
<p>So rustdoc does a weird pass where it removes some layer of the AST</p>



<a name="200026498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200026498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200026498">(Jun 07 2020 at 14:31)</a>:</h4>
<p>which invalidates the DefId tree</p>



<a name="200026546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200026546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200026546">(Jun 07 2020 at 14:32)</a>:</h4>
<p>See <a href="https://github.com/rust-lang/rust/pull/72088">https://github.com/rust-lang/rust/pull/72088</a> and <a href="https://github.com/rust-lang/rust/issues/71820">https://github.com/rust-lang/rust/issues/71820</a> for a similar issue</p>



<a name="200026780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200026780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200026780">(Jun 07 2020 at 14:38)</a>:</h4>
<p>And I don't really know how to help you ... I am also stuck. I think the ultimate goal is to remove <code>ReplaceBodyWithLoop</code> entirely but I don't really understand what is it needed for right now and by what it should be replaced.</p>



<a name="200027685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200027685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200027685">(Jun 07 2020 at 14:59)</a>:</h4>
<p>Oh that's so unfortunate ... <span class="user-mention" data-user-id="116122">@simulacrum</span> do you know if that <code>MAX_DEF_ID</code> snippet is a function somewhere? If so I could just call <code>def_id.is_fake()</code> and then ignore fake ids</p>



<a name="200027689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200027689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200027689">(Jun 07 2020 at 14:59)</a>:</h4>
<p>hm I guess probably no given that it's not being used here?</p>



<a name="200027732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200027732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200027732">(Jun 07 2020 at 15:00)</a>:</h4>
<p>ok, I think I'll make a PR for that</p>



<a name="200027736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200027736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200027736">(Jun 07 2020 at 15:00)</a>:</h4>
<p>but to be honest I'm not familiar with that piece of rustdocs code</p>



<a name="200029851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200029851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200029851">(Jun 07 2020 at 15:56)</a>:</h4>
<p><span class="user-mention" data-user-id="281572">@marmeladema</span> looking at the comments in <a href="https://github.com/Mark-Simulacrum/rust/blob/6f015768c28a6e4cf163967cb62b70c645791858/src/librustdoc/core.rs#L103">https://github.com/Mark-Simulacrum/rust/blob/6f015768c28a6e4cf163967cb62b70c645791858/src/librustdoc/core.rs#L103</a>, it looks like there are two issues: 1. ids which were originally valid, but were invalidated by <code>ReplaceBodyWithLoop</code>, and 2. ids which were always fake and were never valid. The first looks really hard to deal with but also less common, so for now I'm only dealing with the second.</p>



<a name="200030288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200030288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200030288">(Jun 07 2020 at 16:07)</a>:</h4>
<p>Lucky you :p</p>



<a name="200030420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200030420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200030420">(Jun 07 2020 at 16:11)</a>:</h4>
<p>Oh don't worry, I'm sure the first case will show up before I'm through <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="200030428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200030428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200030428">(Jun 07 2020 at 16:11)</a>:</h4>
<p>I'm working on <a href="https://github.com/rust-lang/rust/issues/65983">https://github.com/rust-lang/rust/issues/65983</a> so I'm touching <em>basically</em> every part of the frontend</p>



<a name="200030631"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200030631" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200030631">(Jun 07 2020 at 16:16)</a>:</h4>
<p>Oh your touching the <code>export_map</code> right now? Me too <span aria-label="octopus" class="emoji emoji-1f419" role="img" title="octopus">:octopus:</span></p>



<a name="200031638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200031638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200031638">(Jun 07 2020 at 16:38)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> fyi <a href="https://github.com/rust-lang/rust/pull/73090">https://github.com/rust-lang/rust/pull/73090</a><br>
Dunno if that impacts what you're currently working on</p>



<a name="200032192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200032192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200032192">(Jun 07 2020 at 16:53)</a>:</h4>
<p>Thanks for the link. I'm mostly working on the rustdoc side for now. I didn't realize <code>ExportMap</code> only had local items, that makes sense since they're all from the same crate though.</p>



<a name="200032547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200032547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200032547">(Jun 07 2020 at 17:01)</a>:</h4>
<p>Yay if I don't call <code>.parent()</code> for fake IDs it works <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="200032680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200032680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200032680">(Jun 07 2020 at 17:04)</a>:</h4>
<p>omg the links work too <a href="/user_uploads/4715/HyktyukNaqAox6eiWIKshfGU/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/HyktyukNaqAox6eiWIKshfGU/image.png" title="image.png"><img src="/user_uploads/4715/HyktyukNaqAox6eiWIKshfGU/image.png"></a></div>



<a name="200032694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200032694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200032694">(Jun 07 2020 at 17:04)</a>:</h4>
<p>It links to the external URL though, not to the dependency <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="200032699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200032699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200032699">(Jun 07 2020 at 17:04)</a>:</h4>
<p>let me comment on the issue, we've gotten a little far from the panic</p>



<a name="200042574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200042574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200042574">(Jun 07 2020 at 21:12)</a>:</h4>
<p><span class="user-mention" data-user-id="281572">@marmeladema</span> I ran into the first case <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> </p>
<div class="codehilite"><pre><span></span><code>(-bash@build-server) ~/.../src/test ▶️ rustdoc +stage1 rustdoc/macro-in-closure.rs
thread &#39;rustc&#39; panicked at &#39;called `Option::unwrap()` on a `None` value&#39;, /home/joshua/src/rust/src/librustc_hir/definitions.rs:358:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
(-bash@build-server) ~/.../src/test ▶️ cat !$
cat rustdoc/macro-in-closure.rs
// Regression issue for rustdoc ICE encountered in PR #65252.

#![feature(decl_macro)]

fn main() {
    || {
        macro m() {}
    };
}
</code></pre></div>



<a name="200042761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/panic%20in%20tcx.parent%28def_id%29%3A%20bug%20in%20my%20code%20or%20rustc_middle%3F/near/200042761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> marmeladema <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/panic.20in.20tcx.2Eparent(def_id).3A.20bug.20in.20my.20code.20or.20rustc_middle.3F.html#200042761">(Jun 07 2020 at 21:16)</a>:</h4>
<p>Yes thats exactly the same test that is failing in the issue I mentioned. But as a matter of fact, <span class="user-mention" data-user-id="118594">@ecstatic-morse</span> has started working on this :) we might have a solution sooner than expected</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>